#include <iostream>
#include <algorithm>

using namespace std;

const int N = 1e5 + 10;
const double eps = 1e-5;

int n, f;
double q[N];
double pre_sum[N];

bool check(double x){
    for(int i = 1; i <= n; i ++) pre_sum[i] = pre_sum[i - 1] + q[i] - x;
    
    double maxv = -1;
    double minv = 1e9;
    for(int i = f; i <= n; i ++){
        minv = min(minv, pre_sum[i - f]);
        maxv = max(maxv, pre_sum[i] - minv);
    }
    
    return maxv >= 0;
}

int main(){
    cin >> n >> f;
    for(int i = 1; i <= n; i ++) cin >> q[i];
    
    double l = 1, r = 2000;
    while(l + eps <= r){
        double mid = (l + r) / 2.0;
        if(check(mid)){
            l = mid;
        }else{
            r = mid;
        }
    }
    
    
    printf("%d", (int)(r * 1000));
    return 0;
}